<?php
$headers = array(); 
foreach ($_SERVER as $key => $value) { 
    if ('HTTP_' == substr($key, 0, 5)) { 
        $headers[str_replace('_', '-', substr($key, 5))] = $value; 
    } 
}
parse_str(file_get_contents('php://input'), $data);

$result['method'] = $_SERVER['REQUEST_METHOD'];
$result['header'] = $headers;
$result['get'] = $_GET;
$result['post'] = $_POST;
$result['put'] = $data;

header("content-type:application/json");
echo json_encode($result);
?>